package com.chuanke.ckfamily.service.finance;
import com.chuanke.ckfamily.dao.finance.model.GainPacket;
import com.chuanke.ckfamily.service.exception.CFException;
import com.chuanke.ckfamily.service.finance.vo.RedPacketInfo;
import com.chuanke.ckfamily.service.finance.vo.RedPacketRecod;
import com.weijie.core.IBaseBiz;
import com.weijie.core.Pagination;

import java.util.List;


public interface GainPacketService extends IBaseBiz<GainPacket> {

    /**
     * 红包是否可以领取
     *
     * @param uid
     * @param pid
     * @return
     * @throws CFException
     */
    boolean hasGainedPacket(Long uid, Long pid) throws CFException;

    GainPacket getCanGet(Long uid, Long rid) throws CFException;

    /**
     * 领取红包
     *
     * @param uid 用户id
     * @param pid 红包id
     * @return
     */
    GainPacket getAPacket(Long uid, Long pid) throws CFException;

    boolean synizeCacheToDb();

    /**
     * 获取红包详情
     *
     * @param uid
     * @param pid
     * @return
     * @throws CFException
     */
    GainPacket getGainPacketByUser(Long uid, Long pid) throws CFException;

    /**
     * 红包领取记录
     *
     * @param uid
     * @param packetId
     * @return
     * @throws CFException
     */
    RedPacketInfo getRecords(Long uid, Long packetId) throws CFException;

    /**
     * 查找领取记录
     *
     * @param uid
     * @param p
     * @return
     */
    List<RedPacketRecod> getHistory(Long uid, int p);

    /**
     * 统计领取红包个数
     *
     * @param uid
     * @return
     */
    Long countHistory(Long uid);

    /**
     * 统计领取红包金额
     *
     * @param uid
     * @return
     */
    String sumHistory(Long uid);
}